package com.example.kafka.controller;

import com.example.kafka.service.ProducerServiceBatchSendWrong;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 反例 Controller：批量消息发送
 */
@RestController
@RequestMapping("/wrong/batch")
public class ProducerControllerBatchSendWrong {

    @Autowired
    private ProducerServiceBatchSendWrong service;

    @PostMapping("/send")
    public String send(@RequestParam String topic, @RequestBody List<String> messages) {
        service.sendBatch(topic, messages);
        return "批量消息已发送（反例）";
    }
}